<HTML><HEAD><TITLE>stored_keys_and_values(+StoreHandle, -KeysValues)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Non-logical Variables, Arrays, Bags, Shelves and Stores</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>stored_keys_and_values(+StoreHandle, -KeysValues)</H1>
Retrieve all data stored in a store object
<DL>
<DT><EM>StoreHandle</EM></DT>
<DD>A store handle or store name
</DD>
<DT><EM>KeysValues</EM></DT>
<DD>A variable or list
</DD>
</DL>
<H2>Description</H2>
	This retrieves a list of all key/value pairs which are stored
	in the given store object. If the store is empty, the empty list
	is returned. Otherwise, a list of Key - Value terms is returned.
<P>
	The order of the returned list is undefined.
<P>
	The complexity of this operation is linear in the size of all keys
	and values, since they need to be copied.
<P>
	Note: If StoreHandle is not a handle, then it must be an atom or a
	compound term, and the store is identified by this term's toplevel
	functor together with the context module.
<P>
    
<H3>Modes and Determinism</H3><UL>
<LI>stored_keys_and_values(+, -) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>StoreHandle is uninstantiated
<DT><EM>(5) type error </EM>
<DD>StoreHandle is neither atom nor compound term nor store handle
<DT><EM>(45) record does not exist </EM>
<DD>StoreHandle is not the name of a store
</DL>
<H2>Examples</H2>
<PRE>

    ?- store_create(Handle),
       store_set(Handle, tom, 12345),
       store_set(Handle, name(dick,tracy), phone(42376,home)),
       store_set(Handle, numbers:prime, [2,3,5,7|_More]),
       stored_keys_and_values(Handle, Data).

    Handle = 'STORE'(16'003130e8)
    Data = [(numbers : prime) - [2, 3, 5, 7|_More],
            tom - 12345,
	    name(dick, tracy) - phone(42376, home)]
    Yes (0.00s cpu)

    ?- store_create(Handle),
       stored_keys_and_values(Handle, Data).

    Handle = 'STORE'(16'003130e8)
    Data = []
    Yes (0.00s cpu)
    </PRE>
<H2>See Also</H2>
<A HREF="../../kernel/storage/store-1.html">store / 1</A>, <A HREF="../../kernel/modules/local-1.html">local / 1</A>, <A HREF="../../kernel/storage/store_erase-1.html">store_erase / 1</A>, <A HREF="../../kernel/storage/store_set-3.html">store_set / 3</A>, <A HREF="../../kernel/storage/store_contains-2.html">store_contains / 2</A>, <A HREF="../../kernel/storage/store_get-3.html">store_get / 3</A>, <A HREF="../../kernel/storage/store_delete-2.html">store_delete / 2</A>, <A HREF="../../kernel/storage/stored_keys-2.html">stored_keys / 2</A>, <A HREF="../../kernel/storage/store_create-1.html">store_create / 1</A>, <A HREF="../../kernel/storage/store_count-2.html">store_count / 2</A>
</BODY></HTML>
